package com.ybb.stock.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ybb.stock.entity.Goods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {

    @Select("select price from ybb_goods_price  where sku =#{sku} and #{date}>=begin_time and (end_time is null or #{date}<end_time)")
    Double getGoodsPrice(@Param("sku") String sku, @Param("date") Date date);
}
